/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author stumbledog
 */
@Entity
@Table(name = "nflgame")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Nflgame.findAll", query = "SELECT n FROM Nflgame n"),
    @NamedQuery(name = "Nflgame.findById", query = "SELECT n FROM Nflgame n WHERE n.id = :id"),
    @NamedQuery(name = "Nflgame.findByWeek", query = "SELECT n FROM Nflgame n WHERE n.week = :week")})
public class Nflgame implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "week")
    private Integer week;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nFLGameid")
    private Collection<Nflweekplayer> nflweekplayerCollection;
    @OneToMany(mappedBy = "gameId")
    private Collection<Nflplayergame> nflplayergameCollection;
    @JoinColumn(name = "home", referencedColumnName = "id")
    @ManyToOne
    private Nflteam home;
    @JoinColumn(name = "away", referencedColumnName = "id")
    @ManyToOne
    private Nflteam away;

    public Nflgame() {
    }

    public Nflgame(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getWeek() {
        return week;
    }

    public void setWeek(Integer week) {
        this.week = week;
    }

    @XmlTransient
    public Collection<Nflweekplayer> getNflweekplayerCollection() {
        return nflweekplayerCollection;
    }

    public void setNflweekplayerCollection(Collection<Nflweekplayer> nflweekplayerCollection) {
        this.nflweekplayerCollection = nflweekplayerCollection;
    }

    @XmlTransient
    public Collection<Nflplayergame> getNflplayergameCollection() {
        return nflplayergameCollection;
    }

    public void setNflplayergameCollection(Collection<Nflplayergame> nflplayergameCollection) {
        this.nflplayergameCollection = nflplayergameCollection;
    }

    public Nflteam getHome() {
        return home;
    }

    public void setHome(Nflteam home) {
        this.home = home;
    }

    public Nflteam getAway() {
        return away;
    }

    public void setAway(Nflteam away) {
        this.away = away;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Nflgame)) {
            return false;
        }
        Nflgame other = (Nflgame) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Nflgame[ id=" + id + " ]";
    }
    
}
